//
//  PywCouponListApi.m
//  PywSdk
//
//  Created by Jade on 16/8/15.
//  Copyright © 2016年 zero. All rights reserved.
//

#import "PywCouponListApi.h"
#import "AIFGetCouponManager.h"
#import "PywMBProgressHUD+Pyw.h"
#import "PropertyListReformer.h"
@interface PywCouponListApi()
@property (nonatomic,strong) AIFGetCouponManager *getCouponManager;
@end
@implementation PywCouponListApi

/**
 *  获取代金券
 */
- (void)getCouponListWithStatus:(NSInteger)status
                           page:(NSInteger)page
                        success:(Successd)success
                           fail:(Failure)fail
{
    self.successd = success;
    self.failure = fail;
    self.getCouponManager.status = status;
    self.getCouponManager.page = page;
    [self.getCouponManager loadData];
}

- (AIFGetCouponManager *)getCouponManager
{
    if (!_getCouponManager) {
        _getCouponManager = [AIFGetCouponManager manager];
        _getCouponManager.delegate = self;
    }
    return _getCouponManager;
}


#pragma mark - ETAPIManagerCallBackDelegate

- (void)managerCallAPIDidSuccess:(ETApiBaseManager *)manager
{
    PropertyListReformer *reformer = [[PropertyListReformer alloc] init];
    NSDictionary *dict = [manager fetchDataWithReformer:reformer];
    if (self.successd) {
        self.successd(nil,dict);
    }
}

- (void)managerCallApiDidFailed:(ETApiBaseManager *)manager{
    if (self.failure) {
        self.failure(nil);
    }
    
}


@end
